import { fileURLToPath, URL } from 'node:url'
import { xlsxToArray, getXlsxData, saveJson } from '../../utils.js'

const getFilePath = path => fileURLToPath(new URL(path, import.meta.url))
const src = getFilePath('src/扫码结果.xlsx')
const dist = getFilePath('dist/扫码结果.json')

const xlsxData = getXlsxData(src)
const xlsxArr = xlsxToArray(xlsxData[0].data)

const newData = xlsxArr.map(item => {
  return item
})

saveJson(dist, newData)
